package com.tourismhengyang.impl;

import java.io.IOException;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.tourismhengyang.beans.WayInfo;
import com.tourismhengyang.biz.IWayInfoBiz;
import com.tourismhengyang.dao.DBAccess;

public class WayInfoBizImpl implements IWayInfoBiz{
	private DBAccess db=new DBAccess();
	@Override
	public List<WayInfo> getWayInfoList() {
		SqlSession session = null;
		List<WayInfo> result=null;
		try {
			session=db.getSqlSession();
			IWayInfoBiz wayInfoBiz=session.getMapper(IWayInfoBiz.class);
			result=wayInfoBiz.getWayInfoList();
			session.commit();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return result;
	}

	@Override
	public int addWayInfo(WayInfo wayInfo) {
		SqlSession session = null;
		int result=0;
		try {
			session=db.getSqlSession();
			IWayInfoBiz wayInfoBiz=session.getMapper(IWayInfoBiz.class);
			result=wayInfoBiz.addWayInfo(wayInfo);
			session.commit();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return result;
	}

}
